-
-
Notifications
You must be signed in to change notification settings - Fork 141
remove append #261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove append #261
Conversation
tests/test_series.py
Outdated
def test_getattr() -> None: | ||
# GH 261 | ||
series = pd.Series([1, 2, 3], index=["a", "b", "c"], dtype=int) | ||
check(assert_type(series.a, int), np.int64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately, it doesn't return a builtin int
The error on windows could be a pandas/numpy inconsistency. It seems that our windows CI is 64bit (np.intp is np.int64) but the observed dtype is np.int32. |
pandas-stubs/core/generic.pyi
Outdated
@@ -359,7 +360,7 @@ class NDFrame(PandasObject, indexing.IndexingMixin): | |||
self, func: Callable[..., T] | tuple[Callable[..., T], str], *args, **kwargs | |||
) -> T: ... | |||
def __finalize__(self, other, method=..., **kwargs) -> NDFrame: ... | |||
def __getattr__(self, name: _str): ... | |||
def __getattr__(self, name: _str) -> Series: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to core/frame.pyi
and you can avoid the # type: ignore
in core/series.pyi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @twoertwein
As long as a class as
__getattr__
exist, mypy and pyright assume that.append
(and any other non-existing method) might still exists. Removing__getattr__
has the disadvantage that users can no longer dodf.column_name
.